﻿@model Product

@{
    string returnListUrl = ViewBag.ReturnListUrl;
    bool hasEditProductRole = User.IsInRole("Admin") || User.IsInRole("Edit Product");
    bool hasDeleteProductRole = User.IsInRole("Admin") || User.IsInRole("Delete Product");

    ViewBag.Title = "Sản phẩm " + Model.Name;
}

<section class="content-header">
    <h1>
        Sản phẩm
        <small>@Model.Name</small>
    </h1>
    <ol class="breadcrumb">
        <li>
            <a href="@Url.Action("Index", "Home")">
                <i class="fa fa-home"></i> Trang chủ
            </a>
        </li>
        <li>
            <a href="@Url.Action("Index", "Product")">
                Danh sách sản phẩm
            </a>
        </li>
        <li class="active">@Model.Name</li>
    </ol>
</section>
<section class="content">
    <div class="row">
        <div class="col-md-6">
            <div class="box box-solid">
                <div class="box-body no-padding">
                    @Html.Partial("_Details", Model)
                </div>
                <div class="box-footer text-right">
                    <a href="@(returnListUrl ?? Url.Action("Index", "Product"))" class="btn btn-default pull-left">
                        <i class="fa fa-chevron-left fa-mr"></i> Back to List
                    </a>
                    @if (hasDeleteProductRole)
                    {
                        <a href="@Url.Action("Delete", new { id = Model.Id, returnListUrl = returnListUrl })" class="btn btn-danger">
                            <i class="fa fa-times fa-mr"></i> Xóa
                        </a>
                    }
                    @if (hasEditProductRole)
                    {
                        <a href="@Url.Action("Edit", new { id = Model.Id, returnListUrl = returnListUrl })" class="btn btn-info">
                            <i class="fa fa-edit fa-mr"></i> Chỉnh sửa
                        </a>
                    }
                </div>
            </div>
        </div>
    </div>
</section>

@section scripts{
    <script>
        ActiveMenu('#product-menu');
    </script>
}